
using System.Web.UI.HtmlControls;
using System;
using System.Configuration;
using System.Drawing;
using System.Data;
using System.Web.UI.WebControls;
using Microsoft.VisualBasic;
using System.Collections;
using System.Web.UI;
using System.Web;



namespace smasb2b
{
	public class Supply_Agreement : BasePage
	{
		
#region  Web Form 設計工具產生的程式碼
		
		//此為 Web Form 設計工具所需的呼叫。
		[System.Diagnostics.DebuggerStepThrough()]private void InitializeComponent()
		{
			
		}
		protected System.Web.UI.WebControls.Label lblSUPPLY_AGREEMENT;
		protected System.Web.UI.HtmlControls.HtmlTextArea area_tw;
		protected System.Web.UI.HtmlControls.HtmlTextArea area_en;
		protected ddscControlLibrary.SubmitButtonCtrl btnAGREE;
		protected ddscControlLibrary.SubmitButtonCtrl btnAISSENT;
		protected System.Web.UI.WebControls.Button btnExit;
		protected System.Web.UI.HtmlControls.HtmlInputHidden hidpurchase_no;
		protected System.Web.UI.HtmlControls.HtmlInputButton btnCHANGE_PASSWORD;
		protected System.Web.UI.HtmlControls.HtmlInputButton btnAGREE1;
		protected System.Web.UI.HtmlControls.HtmlInputButton btnAISSENT1;
		
		//注意: 下列預留位置宣告是 Web Form 設計工具需要的項目。
		//請勿刪除或移動它。
		private System.Object designerPlaceholderDeclaration;
		
		private void Page_Init(System.Object sender, System.EventArgs e)
		{
			//CODEGEN: 此為 Web Form 設計工具所需的方法呼叫
			//請勿使用程式碼編輯器進行修改。
			InitializeComponent();
		}
		
#endregion
		string PROG_ID;
		private void Page_Load(System.Object sender, System.EventArgs e)
		{
			//在這裡放置使用者程式碼以初始化網頁
			if (!(Page.Request["PURCHASE_NO"] == null))
			{
				hidpurchase_no.Value = Page.Request["PURCHASE_NO"];
				btnAGREE.Visible = false;
				btnAISSENT.Visible = false;
			}
			else
			{
				btnAGREE1.Visible = false;
				btnAISSENT1.Visible = false;
			}
			
			if (GetLanguage() == "zh-en")
			{
				area_tw.Visible = false;
				area_en.Visible = true;
			}
			else
			{
				area_tw.Visible = true;
				area_en.Visible = false;
			}

            this.btnAGREE.Click += btnAGREE_Click;

            this.btnAISSENT.Click += btnAISSENT_Click;
		}
		
		
		
		private void btnAISSENT_Click(System.Object sender, System.EventArgs e)
		{
			try
			{
				this.RegisterStartupScript("errMessage", "<script language=\"javascript\"> window.location.href=\'/smasb2b/default.aspx\'; </script>");
			}
			catch (Exception ex)
			{
				showException(ex.Message);
			}
		}
		
		private void btnAGREE_Click(System.Object sender, System.EventArgs e)
		{
			try
			{
				string PROG_ID = "";
				if (Page.Request["PURCHASE_NO"] == null)
				{
					PROG_ID = System.Convert.ToString(Page.Request["PROG_ID"].ToUpper());
					if (PROG_ID == "VNDW0031")
					{
						this.RegisterStartupScript("errMessage", "<script language=\"javascript\"> var result= window.showModalDialog(\'/smasb2b/VND/VNDW0031.aspx?action_type=ADD\',null,\'dialogWidth=780PX;dialogHeight=740px;center=yes;border=thin;help=no;status=no;resizable=no;\', true) ; 	window.location.href=\'/smasb2b/default.aspx\'; </script>");
					}
					else
					{
                        String str = (dynamic)String.Format("/smasb2b/VND/{0}.aspx?action_type=ADD&GUID={1}", PROG_ID, Guid.NewGuid().ToString());
						Response.Redirect(str, false);
					}
				}
				else
				{
                    String str = (dynamic)"/smasb2b/VND/" + PROG_ID + ".aspx?action_type=" + Page.Request["action_type"] + "&PURCHASE_NO=" + Page.Request["PURCHASE_NO"] + "&GUID=" + Guid.NewGuid().ToString();
					Response.Redirect(str, false);
				}
			}
			catch (Exception ex)
			{
				showException(ex.StackTrace);
			}
		}
		
	}
	
}
